<div class="content__title">
    <h1>
        角色管理
    </h1>
</div>
<div nz-row [nzGutter]="16">
    <div nz-col [nzMd]="4">
        <app-dept-tree (change)="change($event)">
        </app-dept-tree>
    </div>
    <div nz-col [nzMd]="20">
        <nz-card>
            <ng-template #title>角色列表</ng-template>
            <ng-template #body>
                <nz-table #nzTable [nzDataSource]="data" [nzScroll]="{ y: 1024 }" [nzBordered]="true" [nzSize]="'middle'" [nzIsPagination]="false">
                    <thead nz-thead>
                    <tr>
                        <th nz-th>名称</th>
                        <th nz-th>部门</th>
                        <th nz-th>状态</th>
                        <th nz-th>备注</th>
                        <th nz-th>操作
                            <span *ngIf="acl.canAbility('20')">
                                <span nz-table-divider></span>
                                <a (click)="edit({id:0})">添加</a>
                            </span>
                        </th>
                    </tr>
                    </thead>
                    <tbody nz-tbody>
                    <tr nz-tbody-tr *ngFor="let i of nzTable.data">
                        <td nz-td>{{i.name}}</td>
                        <td nz-td>{{i.deptname}}</td>
                        <td nz-td>
                            <nz-tag *ngIf="i.enable" [nzColor]="'green'">activate</nz-tag>
                            <nz-tag *ngIf="!i.enable" nzColor="orange">disable</nz-tag>
                        </td>
                        <td nz-td>{{i.remark}}</td>
                        <td nz-td>
                            <a *ngIf="acl.canAbility('20')" (click)="edit(i)">编辑</a>
                            <span *ngIf="acl.canAbility('21')">
                                <span nz-table-divider></span>
                                <nz-popconfirm [nzTitle]="'确定删除？'" [nzOkText]="'ok'" [nzCancelText]="'cancel'" (nzOnConfirm)="del(i.id)">
                                    <a nz-popconfirm>删除</a>
                                </nz-popconfirm>
                            </span>
                            <span *ngIf="acl.canAbility('19')">
                                <span nz-table-divider></span>
                                <a (click)="grant(i.id)">资源分配</a>
                            </span>
                        </td>
                    </tr>
                    </tbody>
                </nz-table>
            </ng-template>
        </nz-card>
    </div>
</div>
